
import { useState,useEffect } from "react"
function App() {
    const [count,setCount]=useState(0)
    const [name,setName] = useState('')

    useEffect(()=>{    //只依赖count
        //定义副作用
        document.title = count
    },[count])
  return(
      <div>
          <button onClick={()=>setCount(count +1)}>{count}</button>
          <button onClick={()=>setName('cp')}>{name}</button>
      </div>
  )
}

export default App 